home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xconq / Doc / custom.ms next >
Encoding:
Text File  |  1995-05-09  |  15.4 KB  |  400 lines

  1. ./" SCO SCCS ID: @(#) custom.ms 12.1 95/05/09 
  2. .TL
  3. CUSTOMIZING XCONQ (Made Somewhat Simple)
  4. .AU
  5. Stan Shebs
  6. .AI
  7. Department of Computer Science
  8. University of Utah
  9. .AB
  10. For advanced players who desire new challenges, \fIxconq\fP provides several
  11. customization mechanisms.
  12. It is possible to build new maps, scenarios, and historical periods.
  13. This document describes the customization process in excruciating detail.
  14. The reader is assumed to be familiar with \fIxconq\fP and its basic
  15. documentation.
  16. .AE
  17. .SH
  18. INTRODUCTION
  19. .LP
  20. \fIXconq\fP has been designed to facilitate the construction of new maps,
  21. scenarios, and historical periods.
  22. All these additions happen through a single mechanism, the \fImapfile\fP,
  23. which comes in several parts, and may also load other mapfiles.
  24. Saved games are very detailed mapfiles; less detailed mapfiles are more
  25. suitable as scenarios.  Maps and period descriptions are mapfiles with
  26. most sections missing.
  27. .LP
  28. Mapfiles are created either by text editing,
  29. by \fIxconq\fP, or by a combination of both.  
  30. Since they are mostly read by variations on C's \fIscanf\fP function,
  31. the format is rather rigid; numbers may not be omitted, no blank lines
  32. are allowed (but whitespace between numbers on a line is OK),
  33. and mistakes will not always be recognized.
  34. The one general exception is the period description, which is read by
  35. a lexical analyzer, which allows free-format input.  Other more specific
  36. exceptions will be noted below.
  37. .SH
  38. MAPFILES
  39. .LP
  40. A mapfile is a normal ASCII text file.  It begins with a header line of the
  41. form
  42. .IP
  43. \fBXconq \fIn [+-][+-][+-][+-][+-][+-] description[;]\fR
  44. .LP
  45. where \fIn\fP
  46. is the number of additional mapfiles to be loaded (up to 16 or so in all),
  47. each + or -
  48. indicates the presence or absence of a particular section, and the
  49. \fIdescription\fP
  50. is free-form text (remainder of the line) describing the mapfile.
  51. Note that that all reading/writing in the mapfile is case-sensitive,
  52. including the header words.
  53. The sections are for version, period, map, globals, sides, and units,
  54. in that order.  Most sections vary in size, and some vary also in
  55. the detail of the information they contain.  Most include extension
  56. flags, which are reserved for future expansion of mapfiles.
  57. .LP
  58. Additional notes may be included by terminating the \fIdescription\fP
  59. with a semicolon (with NO whitespace following).
  60. In such a case, the following text lines
  61. will skipped over until a period "." is seen by itself on a line.
  62. .LP
  63. Following the header are the names of the \fIn\fP
  64. mapfiles, one to a line.
  65. Each will be loaded into \fIxconq\fP before the rest of the current mapfile.
  66. This process is recursive (at least in theory).  Any conflicts are
  67. resolved by simple overwriting.  Note that this presents the possibility
  68. of catastrophic conflicts if the designer is not careful to, say, match
  69. units and periods.  A file with a given name will be loaded only once;
  70. a second attempt will result in a warning message, and the program will
  71. continue on.
  72. .LP
  73. The version section is quite simple, since it is one line;
  74. exactly the version
  75. string displayed when \fIxconq\fP starts up.  This is typically only needed for
  76. saved games, but might be convenient while \fIxconq\fP versions are changing
  77. incompatibly.
  78. When this section is loaded, the version is merely compared with the
  79. internal version number, and \fIxconq\fP fails if they do not match.
  80. .LP
  81. The period section is a program in a simple postfix language,
  82. which when executed fills in the period description.
  83. .LP
  84. The map section includes the world dimensions and terrain.
  85. It may also include information about countries at some future date.
  86. .LP
  87. The globals section includes any global values, such as the current turn,
  88. and also the win/lose conditions for a scenario.
  89. .LP
  90. The sides section defines the sides in a game.  Required info is little
  91. more than the name of the side, but a detailed section may also include
  92. the area of the map seen by that side, and other data.
  93. .LP
  94. Finally, the units sections lists a number of units in the game.
  95. Again, detail can range from type, name, and position to complete
  96. details on its orders.
  97. .LP
  98. Each of these sections is entirely optional - \fIxconq\fP can synthesize its
  99. own replacements for each.  For instance, a mapfile could specify a map
  100. and two sides, or a period, or an entire game, by including the appropriate
  101. sections.
  102. The sections do interact somewhat, with dependencies as follows:
  103. .IP
  104. Maps, win/lose conditions in globals,
  105. detailed sides, and units depend on period.
  106. .IP
  107. Detailed and/or non-neutral units depend on sides.
  108. .LP
  109. The following sections discuss each part of a mapfile in more detail.
  110. The version secton
  111. has already been covered sufficiently.
  112. Since the period defines what may appear in all the other sections,
  113. I shall begin with it.
  114. .so period.ms
  115. .SH
  116. MAPS
  117. .LP
  118. Maps alone are the easiest thing to customize.  You can either do ordinary
  119. text editing to acquire the map data, then add the headers, or use the
  120. online terrain editing capability of \fIxconq\fP and save the terrain alone.
  121. .LP
  122. The map header has the form
  123. .IP
  124. \fBMap \fIwidth height scale seen extension\fR
  125. .LP
  126. where \fIwidth\fP and \fIheight\fP are the size of the map,
  127. while the \fIscale\fP is
  128. the width of a single hex in km (measured between parallel faces).
  129. The \fIseen\fP flag is \fB0\fP if the map is not known to the players,
  130. and \fB1\fP if it is (this is like using \fB"-v"\fP on the command line).
  131. The \fIextension\fP
  132. is an extension flag, with a value of \fB0\fP for the normal map.
  133. Other values are reserved for extensions.
  134. .LP
  135. The preferred way to build a map is to use the \fB"-B"\fP
  136. option of \fIxconq\fP.
  137. This enables the space bar to "paint" terrain onto the map.
  138. The "brush" is defined by using the terrain characters as commands
  139. (they will override any normal commands on the same letters).
  140. The argument is also useful - if positive, it is the radius of the
  141. area to be painted with the given terrain type, if negative,
  142. it is the length of a horizontal bar.  Thus, in the standard period,
  143. the sequence \fB"999. "\fP will convert all but the largest maps into open sea.
  144. To save the map by itself, answer with the string "m" when "saving the game"
  145. (described in more detail below).
  146. .LP
  147. The other way to build is by using a text editor and following the format
  148. exactly.
  149. The terrain data is a number of long lines of characters.  The length of
  150. the lines must be exactly the width of the map.  The characters for
  151. terrain types are defined by the period.
  152. The coordinate system is Cartesian oblique, with the y axis tilted to form
  153. a 60-degree angle with the x axis.  Thus, landforms in the mapfile should
  154. appear to be leaning to the left, if they are to appear upright during play.
  155. .LP
  156. Maps should have some distinguishing terrain
  157. on the northern and southern edges;  also, remember that the default
  158. map shape wraps around in the east-west direction, so landforms should
  159. match up.  If the wraparound is undesirable, a vertical stripe of
  160. some otherwise-unused type (such as outer space) is useful to block movement.
  161. .LP
  162. Run-length encoding is also available.  It is flagged by a numeric digit,
  163. followed by any number of digits, followed by a terrain character.  The
  164. terrain character will be replicated the number of times specified by the
  165. digit string.  The encoding may be freely intermixed with normal terrain,
  166. but cannot extend over line boundaries.
  167. .SH
  168. GLOBALS
  169. .LP
  170. Globals include a number of values affecting an entire game.  The header
  171. is in the following form:
  172. .IP
  173. \fBGlobals \fIgametime endtime setproduct leavemap numconds extension\fR
  174. .LP
  175. where \fIgametime\fP is the elapsed turns, \fIendtime\fP is the last turn
  176. of the game, \fIsetproduct\fP controls whether unit construction is changeable,
  177. \fIleavemap\fP allows units to leave by the map edges,
  178. and \fIextension\fP is reserved for extensions (is normally \fB0\fP).
  179. .LP
  180. \fInumconds\fP specifies the number of winning/losing conditions.
  181. Conditions are evaluated at the end of each turn (along with other
  182. ways to lose, such as losing all of one's units).
  183. A win condition results in the side achieving it winning
  184. while all others lose.
  185. A losing condition knocks the side out of the game, and the other sides
  186. continue normally.
  187. Multiple win and lose conditions
  188. act as disjunctions - when one is satisfied, something will happen.
  189. There is a limit of about 10 conditions or so.
  190. All conditions include a starting and ending time for
  191. when they are in effect, as well as the number of a side to which it
  192. applies, or \fB-1\fP it is to be applied to all sides equally.
  193. .LP
  194. The first line of a condition is the same for all types:
  195. .IP
  196. \fI win/lose type start end side(s)\fR
  197. .LP
  198. where \fIwin/lose\fP is \fB1\fP if the condition is for winning
  199. and \fB0\fP for losing,
  200. \fIstart\fP and \fIend\fP are the starting and ending turns for testing
  201. the condition, \fIside(s)\fP is the number of a side to which the condition
  202. applies (or \fB-1\fP if it applies to any side), 
  203. and \fItype\fP is the type of condition:
  204. .IP \fB0\fP
  205. Territory; next line is one number, the amount of territory
  206. (above if to win, below if to lose).
  207. .IP \fB1\fP
  208. Number of units; next line is list of numbers, one for each unit type.
  209. To win, must possess at least that many of each type.
  210. To lose, must be at or below that many for \fIall\fP unit types
  211. simultaneously
  212. (the default losing condition is this one, with all zeros).
  213. To make this condition apply to only one unit type, set all the other
  214. numbers to very low (for win condition) or very high (for lose condition)
  215. values, outside the range normally occurring during a game.
  216. .IP \fB2\fP
  217. Quantity of resources; next line is a list of numbers, one for each
  218. resource type.  Winning and losing is same as for unit types.
  219. .IP \fB3\fP
  220. Possession; next line is three numbers,
  221. the first two representing the coordinates of a hex, and the third
  222. the number of a unit type (or \fB-1\fP to indicate all unit types).
  223. To win, must have a unit of the specified type on the hex.
  224. To lose, do not have a unit on that hex.
  225. .LP
  226. Each condition has a sort of dual identity, since it is interpreted
  227. slightly differently, depending on whether it is flagged for winning
  228. or losing.  The logic is a little twisted perhaps - special conditions
  229. should have all cases tested carefully before a scenario is released.
  230. .SH
  231. SIDES
  232. .LP
  233. Sides need relatively little information stored about them, particularly
  234. for a scenario.  The header is simple:
  235. .IP
  236. \fBSides \fInumsides detail extension\fR
  237. .LP
  238. where
  239. .I numsides
  240. is the number of sides recorded, and
  241. .I detail
  242. is the level of detail that was recorded.
  243. .LP
  244. The side's name can be set using the naming or \fBC\fPall command, when
  245. the cursor is not over a unit, or if an argument is supplied (this will be
  246. the number of a side, and can be used in build mode to change the names
  247. of other sides).
  248. .LP
  249. The exact contents of each level of detail are as follows:
  250. .IP \fB1\fP
  251. Name of side only is saved.  This is sufficient for many scenarios.
  252. .IP \fB2\fP
  253. Name, attributes, and political status and production counts (used for
  254. numbering unnamed units) saved.
  255. .IP \fB3\fP
  256. All of above, plus view of explored part of world.
  257. .IP \fB4\fP
  258. All of above, plus hosts and player types, plus statistics if used.
  259. .IP \fB9\fP
  260. All possible data.  This is the level used for saved games.
  261. (At the moment, this is equivalent to level 4, but may include more data
  262. in the future.)
  263. .LP
  264. The data for each level begins on a new line, and some levels need several
  265. lines (such as the view data).  The best way to study the layout is to
  266. examine a saved game.
  267. .SH
  268. UNITS
  269. .LP
  270. Units have quite a few attributes, nearly all of which must be saved.
  271. The header is as simple as for sides:
  272. .IP
  273. \fBUnits \fInumunits detail extension\fR
  274. .LP
  275. where \fInumunits\fP is the number of units saved, \fIdetail\fP
  276. is the level of detail that was recorded, and of course \fIextension\fP
  277. is the usual extension with only a value of \fB0\fP.
  278. There are several levels of detail:
  279. .IP \fB1\fP
  280. Type, name, and position, and side.
  281. The re-created units will be fully supplied and awake.
  282. Neutral units have a side of -1.
  283. Units capable of construction will be idled, so there should be at
  284. least one movable unit present.
  285. .IP \fB2\fP
  286. All of above, plus scalar attributes and supply amounts, all on one line.
  287. (Look at a saved game or the source code to interpret the numbers.)
  288. .IP \fB3\fP
  289. All of above, plus orders and standing orders if defined.
  290. .IP \fB9\fP
  291. All possible data.  This is the level used for saved games.
  292. (Same as level 3 at present.)
  293. .LP
  294. Build mode offers a number of way to manipulate units on any side,
  295. as described in the next section.
  296. .SH
  297. SCENARIOS
  298. .LP
  299. The \fB-B\fP command line option starts up \fIxconq\fP in \fIbuild mode\fP,
  300. where many
  301. additional actions are possible, all oriented towards the editing of
  302. game state.  All commands can be performed on any side's units, and
  303. none of the machine players will move (this can be toggled by using the
  304. quit command 'Q', then saying 'n' to the confirmation question).  Build mode
  305. allows some other acts:
  306. .IP
  307. Move any unit anywhere instantly, using the moveto command 'm'.
  308. .IP
  309. Create any unit anywhere, using '\\' (prompts for unit type, argument
  310. specifies side, defaults to neutral).
  311. .IP
  312. Modify terrain anywhere, as described under the map section.
  313. .IP
  314. See all units everywhere, using 'V'
  315. .IP
  316. Do anything to any unit as if it were your own, using the usual commands.
  317. .LP
  318. Once all desired changes have been made, you may wish to allow machine
  319. players to move a little, just to randomize things a bit.  Then use the
  320. normal game save command.  In build mode, you will be asked to enter a
  321. string indicating sections and levels of detail.  The string should contain
  322. a character for each section you want written out - 'g' for globals, 'u'
  323. for units, and so forth.  The letters 'u' and 's' must each be followed by
  324. a digit indicating the level of detail desired, as described earlier.
  325. The default string is \fB"ms1u1"\fP, which will write a mapfile with the map,
  326. side names, and unit types/names/positions/sides, which is sufficient
  327. for many interesting scenarios.
  328. The file that will be written is always called \fB"random.scn"\fP,
  329. is written into the current directory, and should be renamed as desired.
  330. After sufficient playtesting, it may be added to the scenario menu, just
  331. by adding its name to the file \fB"mapfiles"\fP in the library directory.
  332. .LP
  333. Scenario construction is not for everybody.  Since the processes are
  334. semi-internal, the error-checking is not as extensive.  For instance,
  335. you can load a submarine with battleships as passengers.  There are
  336. also more subtle questions of balance, which are usually revealed by
  337. repeated play of the scenario.  As a rule, the lower levels of detail
  338. are safer to use - level 1 details for sides and units are often
  339. simple enough to be typed in or edited by hand.
  340. .SH
  341. EXAMPLES
  342. .LP
  343. A period description with only infantry and cities:
  344. .DS
  345. Xconq 0 -+---- Very simple test period
  346. Period 0
  347.  
  348. "generic" period-name
  349.  
  350. "standard" font
  351.  
  352. "i" "infantry" "moves around" utype
  353. "@" "city" "makes infantry units" utype
  354.  
  355. "+" "land" "green" ttype  ; must always have at least one terrain type
  356.  
  357. 1 @ in-country
  358. 100 land @ favored
  359.  
  360. @ first-unit
  361. i first-product
  362.  
  363. 1 i @ make
  364. true @ maker
  365. 1 i @ capacity  ; makers need to be able to hold or be held by products
  366.  
  367. 1 i speed
  368.  
  369. 0 t* i moves
  370.  
  371. begin{notes}
  372. This is just a test.
  373. Kids, don't try this at home!
  374. end{notes}
  375.  
  376. end
  377. .DE
  378. A tiny map with two cities, including an "empire" period description to ensure
  379. meaningful city definitions:
  380. .DS
  381. Xconq 1 --+--+ Tiny map;
  382. just an example...
  383. .
  384. empire.per
  385. Map 9 5 100 1 0
  386. :........
  387. :.+++++..
  388. :..+^^^..
  389. :...+~~..
  390. :........
  391. Units 2 1 0
  392. @ New Cork 2,3 -1
  393. @ Old York 4,1 -1
  394. .DE
  395. .SH
  396. LOSSAGES
  397. .LP
  398. Several words are marked NIY, meaning that although they can be used,
  399. the code does not actually take them into account.
  400.